#pragma once
#include <stdint.h>

#include "esp_err.h"

#if 1
#define I2C_MASTER_SCL_IO GPIO_NUM_4
#define I2C_MASTER_SDA_IO GPIO_NUM_5

#define KEY1 GPIO_NUM_3
#define KEY2 GPIO_NUM_0
#define KEY3 GPIO_NUM_1

#define LED1 GPIO_NUM_7
#define LED2 GPIO_NUM_6
#endif

#define WIFI_SSID_LEN_MAX 32
#define WIFI_PASS_LEN_MAX 64
#define IP_ADDRESS_LEN_MAX 16

extern char g_mac_str[18];

typedef struct {
  char wifi_ssid[WIFI_SSID_LEN_MAX];
  char wifi_pass[WIFI_PASS_LEN_MAX];
  char tcp_server_ip[IP_ADDRESS_LEN_MAX];
  uint16_t tcp_server_port;
  float temp_k;
  float temp_b;
  float humi_k;
  float humi_b;
  uint32_t collect_interval;
  uint32_t upload_interval;
} g_cfg_t;
extern g_cfg_t g_cfg;
esp_err_t nvs_init(void);
esp_err_t save_config_nvs(g_cfg_t *cfg);
esp_err_t load_config_nvs(g_cfg_t *cfg);
